package com.trade.wzj.service.xiang;

import java.util.List;

import com.trade.wzj.dao.xiang.ClientOrderInfoDao;
import com.trade.wzj.model.xiang.ClientOrderInfo;

public class ClientOrderInfoimpl implements ClientOrderInfoService {
	private ClientOrderInfoDao mapper;

	public ClientOrderInfoDao getMapper() {
		return mapper;
	}

	public void setMapper(ClientOrderInfoDao mapper) {
		this.mapper = mapper;
	}
	/*
	 * (non-Javadoc)客户订单添加
	 * @see com.trade.wzj.service.xiang.ClientOrderInfoService#ClientOrderInfoAdd(com.trade.wzj.model.xiang.ClientOrderInfo)
	 */
	@Override
	public boolean ClientOrderInfoAdd(ClientOrderInfo clientorderinfo) throws Exception {
		boolean bol=false;
		if (clientorderinfo.getClientOrderNo().equals("")) {
			try {
				throw new Exception("不能为空");
			} catch (Exception e) {
				e.printStackTrace();
			}
		} else if (clientorderinfo.getClientQuotaDetailsID() == null) {
			try {
				throw new Exception("不能为空");
			} catch (Exception e) {
				e.printStackTrace();
			}
		} 
		 else {
			int result = mapper.ClientOrderInfoAdd(clientorderinfo);
			if (result > 0) {
				System.out.println("添加成功");
				bol=true;
			}
		}
		return bol;
	}

	//查询客户订单信息
	@Override
	public List<ClientOrderInfo> getAllClientOrderInfo(String clientName)throws Exception {
		List<ClientOrderInfo> list=null;
		try {
				list=mapper.getAllClientOrderInfo(clientName);
			
		} catch (Exception e) {
			throw new Exception();
		}
		return list;
	}



}
